package com.jcroke.PC32.serialize;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import com.jcroke.DACGraph.RDFData;

/**
 * 
 * @author jcroke
 *
 */
public class RDFSerializer {

	public static void serializeRDF(RDFData source, String file)
			throws IOException {

		FileOutputStream fout = new FileOutputStream(file);
		ObjectOutputStream oos = new ObjectOutputStream(fout);
		oos.writeObject(source);
		oos.close();
	}

	public static RDFData deserializeRDF(String source) throws IOException,
			ClassNotFoundException {
		RDFData rdf = null;

		FileInputStream fin = new FileInputStream(source);
		ObjectInputStream ois = new ObjectInputStream(fin);
		rdf = (RDFData) ois.readObject();
		ois.close();
		return rdf;
	}
}